﻿
using MahApps.Metro.Controls;
using MahApps.Metro.Controls.Dialogs;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZoneLine
{
    public class MyViewBase : MetroWindow
    {
        public MyViewBase()
        {
            this.DataContext = ViewModel;
        }
        private ViewModelBase _ViewModel;
        public ViewModelBase ViewModel
        {
            get => _ViewModel; set
            {
                if (_ViewModel != value)
                {
                    _ViewModel = value;
                    this.DataContext = _ViewModel;
                }
            }
        }

        protected async Task<bool> Confirm(string msg)
        {
            var rlt = await this.ShowMessageAsync("确定", msg, MessageDialogStyle.AffirmativeAndNegative);
            if (rlt == MessageDialogResult.Affirmative)
            {
                return true;
            }
            return false;
        }

        protected void ShowMsg(string msg)
        {
            this.ShowMessageAsync("提示", msg, MessageDialogStyle.Affirmative);
        }

    }
}
